<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}"
	rel="stylesheet" />
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-role-add">
			<div class="form-group">
				<label class="col-sm-3 control-label ">模板名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="modelName" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">顶部文字：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="topName" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">产品一名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="productOneName" >
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">产品一链接：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="productOneLink" >
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">产品一链接文字：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="productOneLinkText" >
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">产品二名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="productTwoName" >
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">产品二链接：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="productTwoLink" >
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">产品二链接文字：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="productTwoLinkText" >
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">底部文字：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="endName" >
				</div>
			</div>
		</form>
	</div>
	<div th:include="include::footer"></div>
	<script
		th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
	<script type="text/javascript">
		$("#form-role-add").validate({
			rules:{
                modelName:{required:true,},
                topName:{required:true,},
                productOneName:{required:true,},
                productOneLink:{ required:true, },
                endName:{ required:true, },
			},
			messages: {}
		});
		function submitHandler() {
	        if ($.validate.form()) {
	        	add();
	        }
	    }
		function add(){
        	var modelName = $("input[name='modelName']").val();
			var topName = $("input[name='topName']").val();
			var productOneName = $("input[name='productOneName']").val();
			var productOneLink = $("input[name='productOneLink']").val();
            var productOneLinkText = $("input[name='productOneLinkText']").val();
			var productTwoName = $("input[name='productTwoName']").val();
            var productTwoLink = $("input[name='productTwoLink']").val();
            var productTwoLinkText = $("input[name='productTwoLinkText']").val();
            var endName = $("input[name='endName']").val();
			$.ajax({
				cache : true,
				type : "POST",
				url : ctx + "system/wxTemplates/add",
				data : {
                    "modelName": modelName,
					"topName": topName,
					"productOneName": productOneName,
					"productOneLink": productOneLink,
                    "productOneLinkText": productOneLinkText,
                    "productTwoName": productTwoName,
                    "productTwoLink": productTwoLink,
                    "productTwoLinkText": productTwoLinkText,
                    "endName": endName
				},
				async : false,
				error : function(request) {
					$.modal.alertError("系统错误");
				},
				success : function(data) {
					$.operate.successCallback(data);
				}
			});
		}
	</script>
</body>
</html>
